package com.swjd.service.impl;

import com.swjd.dao.UserMapper;
import com.swjd.pojo.User;
import com.swjd.pojo.UserKey;
import com.swjd.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by hxl on 2019/5/31  8:53
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User selectUser(UserKey key) {//根据UserKey账号密码验证账号密码是否正确,并返回User对象
        return userMapper.selectUser(key);
    }

    @Override
    public User selectUserByPhone(String tel) {//用户通过手机号登录,返回User对象
        return userMapper.selectUserByPhone(tel);
    }

    @Override
    public int insertUser(User user) {//通过User对象进行注册用户信息
        return userMapper.insertUser(user);
    }

    @Override
    public int updateByUser(User user){//修改用户信息
        return userMapper.updateByUser(user);
    }
}
